# Project: draft_privateer

CPP  = g++
CC   = gcc
SRC_DIR = src/
OBJ  = main.o render.o map.o physics.o walls.o
LINKOBJ  = main.o render.o map.o physics.o walls.o
LIBS =  -L"/usr/lib" -L"../lib" `sdl-config --libs` -lbox2d -lrt
INCS =  -I"/usr/include" -I"../include" 
CXXINCS = $(INCS)
BIN  = privateer
CXXFLAGS = $(CXXINCS) `sdl-config --cflags`
CFLAGS = $(INCS) -Dmain=SDL_main
RM = rm -f

.PHONY: all all-before all-after clean clean-custom walls_test

all: all-before privateer all-after

walls_test: walls_test.cpp
	$(CPP) -c walls.cpp -o walls.o $(CXXFLAGS)
	$(CPP) -c walls_test.cpp -o walls_test.o $(CXXFLAGS)
	$(CPP) walls_test.o walls.o -o walls_test $(LIBS)

walls.o: walls.cpp
	$(CPP) -c walls.cpp -o walls.o $(CXXFLAGS)

clean: clean-custom
	${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)

main.o: main.cpp
	$(CPP) -c main.cpp -o main.o $(CXXFLAGS)

render.o: render.cpp
	$(CPP) -c render.cpp -o render.o $(CXXFLAGS)

map.o: map.cpp
	$(CPP) -c map.cpp -o map.o $(CXXFLAGS)

physics.o: physics.cpp
	$(CPP) -c physics.cpp -o physics.o $(CXXFLAGS)

